import { WidgetMap } from "@ali-dayu/form-editor";
import { CodeSetterName } from "./CodeSetter";

const widgetKey = "TextareaField";

const newConfig = {
  ...WidgetMap[widgetKey],
  cfg: {
    ...WidgetMap[widgetKey].cfg,
    dropToColumnEnable: true,
    setters: [
      {
        propName: "_id",
        setterName: CodeSetterName,
        props: { label: "表单编码" },
      },
      {
        propName: "enableAsFlowVariable",
        setterName: 'EnableAsFlowVariableSetter',
        props: { label: "是否启用变量" },
      },
      {
        propName: "defaultValue",
        setterName: "Input",
        props: {
          label: "默认值",
          placeholder: "请输入默认值",
        },
      },
      {
        propName: "label",
        setterName: "Input",
        props: {
          label: "标题",
          subLabel: "最多20字",
          maxLength: 20,
          validateMessage: {
            required: "标题不能为空",
          },
        },
      },
      {
        propName: "placeholder",
        setterName: "Input",
        props: {
          label: "提示文字",
          subLabel: "最多50字",
          maxLength: 50,
        },
      },
      {
        propName: "ratio",
        setterName: "RatioSetter",
        props: {
          label: "字段占比",
        },
      },
      {
        propName: "required",
        setterName: "Switch",
        props: {
          label: "必填",
        },
      },
    ],
    props: {
      label: "多行输入框",
      placeholder: "请输入",
      required: false,
      ratio: 12,
      enableAsFlowVariable: false,
    },
  },
};

const setting = {
  widget: {
    [widgetKey]: newConfig,
  },
};

export default setting;
